<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <title>微光协同办公平台-会议列表</title>
    <link th:href="@{/css/bootstrap.min.css?v=3.3.6}" rel="stylesheet"/>
    <link th:href="@{/css/font-awesome.css?v=4.4.0}" rel="stylesheet"/>
    <link th:href="@{/css/plugins/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/animate.css}" rel="stylesheet"/>
    <link th:href="@{/css/style.css}" rel="stylesheet"/>

</head>

<body>
<div class="col-sm-12" style="height: 30px;"></div>
<div class="col-sm-12">
    <!-- Example Events -->
    <div class="example-wrap">
        <div class="example">
            <div id="meetTableTools">
                <div class="btn-group hidden-xs" role="group">
                    <button type="button" class="btn btn-outline btn-default" onclick="add()">
                        <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                    </button>
                    <!--<button type="button" class="btn btn-outline btn-default" onclick="modfiy()">-->
                        <!--<i class="glyphicon glyphicon-edit" aria-hidden="true"></i>-->
                    <!--</button>-->
                    <button type="button" class="btn btn-outline btn-default" onclick="deleteMsg()">
                        <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
                    </button>
                    <div class="input-group" style="padding-left:10px;">
                        <input id="search" name="search_info" type="text" class="input-sm" maxlength="10" style="border-radius:2px; border: 1px solid rgba(151,151,151,.7);" placeholder="按会议主题搜索"/>
                        <button class="btn-sm btn-default btn-outline" id="search_btn" style="border: 1px solid rgba(151,151,151,.7);"><i class="glyphicon glyphicon-search" aria-hidden="true"></i></button>
                    </div>
                </div>
            </div>
            <table id="meetTable" data-mobile-responsive="true">
            </table>
        </div>
    </div>
    <!-- End Example Events -->
</div>
</body>
<!-- 全局js -->
<script th:src="@{/js/jquery.min.js?v=2.1.4}"></script>
<script th:src="@{/js/bootstrap.min.js?v=3.3.6}"></script>

<!-- 自定义js -->
<script th:src="@{/js/content.js?v=1.0.0}"></script>
<script th:src="@{/js/plugins/layer/layer.js}"></script>

<!-- Bootstrap table -->
<script th:src="@{js/plugins/bootstrap-table/bootstrap-table.min.js}"></script>
<script th:src="@{/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js}"></script>
<script th:src="@{/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
<!-- Peity -->
<script src="js/demo/meetTable.js"></script>
<script>
    var xhr = new XMLHttpRequest()
    function add() {
        location.href = "toAddMeet"
    }

    function modify(thisz) {
        var meetId = $(thisz).parents("tr").children().eq(1).text();
        location.href = "toModifyMeet"+"?meetId="+ meetId;

    }
    var xhr =new XMLHttpRequest();
    function deleteMsg() {
        var meetIds = $.map($("#meetTable").bootstrapTable('getSelections'),function (row) {
            return row.meetId;
        })
        if(meetIds.length == 0) layer.msg("请选择一条信息删除")
        /* <![CDATA[ */
        var formData = new FormData();
        for(var i = 0; i < meetIds.length;i++){
            formData.append("meetIds", meetIds[i]);
        }
        /* ]]> */

        xhr.open("post", "deleteMeet");
        xhr.send(formData);
        xhr.timeout = 7000;
        xhr.timeout = function () {
            layer.msg("连接超时，请重试")
        }
        xhr.onreadystatechange = function (ev) {
            var responses = JSON.parse(xhr.response);
            /* <![CDATA[ */
            if(responses.code == 200 && xhr.readyState == 4 && xhr.status == 200){
                layer.confirm("会议删除成功",{
                    icon: 1,
                    btn:["确定"]
                },function () {
                    location.href = "toMeetList";
                });
            }
            /* ]]> */
        }
    }

    function detailed(thisz) {
        var meetId = $(thisz).parents("tr").children().eq(1).text();
        location.href = "toMeetDetails"+"?meetId="+ meetId;
    }

</script>
</html>